package com.cloudsea.yunhaistores.controller;

import com.cloudsea.yunhaistores.service.DashboardService;
import com.cloudsea.yunhaistores.vo.DashboardSummaryVO;
import com.cloudsea.yunhaiutils.common.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "商家-数据看板", description = "为商家提供核心经营数据的统计接口")
@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    @Operation(summary = "获取今日经营数据摘要", description = "商家后台首页调用，用于展示今日营业额、订单数等核心指标")
    @GetMapping("/summary")
    public ApiResponse<DashboardSummaryVO> getTodaySummary() {
        DashboardSummaryVO summary = dashboardService.getTodaySummary();
        return ApiResponse.success(summary);
    }
}
